package es.ats.codington.festival.junit;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import es.ats.codington.festival.domain.Place;
import es.ats.codington.festival.domain.Theater;
import es.ats.codington.festival.domain.Visitor;
import es.ats.codington.festival.services.PlaceService;
import es.ats.codington.festival.services.VisitorService;

public class TestPlaceServices extends TestCase {
	
	Place place;

	@Before
	public void setUp() throws Exception {
		super.setUp();
	}

	@After
	public void tearDown() throws Exception {
		super.tearDown();
	}

	
	@Test
	public void testCreatePlace() {
		
		place = new Place("Bernabeu", "Castellana, 200", 80000, "North Town", "Real Madrid Stadium","Stadium");
		
		boolean aux = true;
		
		PlaceService vis = new PlaceService();
				
		try{
			aux = vis.createPlace(place);
			assertEquals(true, aux);
			
		}catch(Exception ex){
			fail("Not yet implemented");
		}
	
	}

	@Test
	public void testUpdatePlace() {
		
		place = new Place("Bernabeu", "Castellana, 200", 88000, "North Town", "Real Madrid Stadium","Stadium");
		int idplace = 84;
		boolean aux = true;
		
		PlaceService vis = new PlaceService();
				
		try{
			aux = vis.updatePlace(place, idplace);
			assertEquals(true, aux);
			
		}catch(Exception ex){
			fail("Not yet implemented");
		}
		
	}


	
	@Test
	public void testViewPlace() {
		
		place = new Place("Bernabeu", "Castellana, 200", 80000, "North Town", "Real Madrid Stadium","Stadium");
		int idplace = 84;
		
		Place aux = null;
		
		PlaceService vis = new PlaceService();
				
		try{
			aux = vis.viewPlace(idplace);

			assertEquals(place.getName(),aux.getName());
			
		}catch(Exception ex){
			fail("Not yet implemented");
		}
		
	}

}
